
				<div class="box span12">
					<div class="box-header" data-original-title>
						<h2><i class="halflings-icon white edit"></i><span class="break"></span>分类修改</h2>
						<div class="box-icon">
							<a href="#" class="btn-setting"><i class="halflings-icon white wrench"></i></a>
							<a href="#" class="btn-minimize"><i class="halflings-icon white chevron-up"></i></a>
							<a href="#" class="btn-close"><i class="halflings-icon white remove"></i></a>
						</div>
					</div>
					<div class="box-content">
						<form class="form-horizontal" method="post" action="index.php?c=cate&a=edit&admin=1">
						  <fieldset>
                          <input type="hidden" name="id" value="<?php echo $data['id'] ?>"/>
							<div class="control-group">
							  <label class="control-label" for="typeahead">分类名称</label>
							  <div class="controls">
								<input type="text" name="name" class="span6 typeahead" id="typeahead"  data-provide="typeahead" data-items="4" value="<?php echo $data['name'] ?>">
							  </div>
							</div>
                            <div class="control-group">
                              <label class="control-label" for="typeahead">分类归属</label>
                                <div class="controls sel_list">
                                <?php foreach($cate as $k=>$v1){?>
                                    <select class="sel" size="1" name="pid" aria-controls="DataTables_Table_0">

                                        <option value="0">顶级分类</option>
                                        <?php foreach($v1 as $v) { ?>
                                        <option value="<?php echo $v['id']?>" <?php echo ($k==$v['id'])?'selected="selected"':'' ?>  ><?php echo $v['name']?></option>
                                        <?php } ?>
                                    </select>
                                    <?php } ?>
                                </div>
                            </div>




							<div class="form-actions">
							  <button type="submit" class="btn btn-primary">提交</button>
							  <button type="reset" class="btn">清空</button>
							</div>
						  </fieldset>
						</form>

					</div>
				</div><!--/span-->
                                <script src="resources/admin/js/jquery-1.9.1.min.js"></script>
                <script  type="text/javascript" >
                    $(function(){
                        $('.sel_list').on('change','select',function(event) {
                            var id=$(this).val();
                            //移除该标签后面同级标签
                            $(this).nextAll().remove();
                            //获取option文本
                            //var p=$(this).find('option:selected').text();
                            //获取option下标
                            //$(this).get(0).selectedIndex
                            if($(this).get(0).selectedIndex==0){
                                return false;
                            }
                            /* Act on the event */


                            $.ajax({
                                type: 'GET',
                                url: 'index.php?c=cate&a=edit&admin=1&id='+id,
                                dataType:'json',
                                //data: {},
                                success:function(data){
                                    var html='';
                                    html+='<select class="sel" size="1" name="pid" aria-controls="DataTables_Table_0">';
                                    html+='<option value="'+id+'">上一级</option>';
                                         for (i in data){
                                        html+='<option value="'+data[i].id+'">'+data[i].name+'</option>';
                                        }
                                    html+='</select>';
                                    //追加
                                    $('.sel_list').append(html);
                                }
                            })

                        });
                    })
                </script>
